package br.urca.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class GradeCursoPK implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Column(name = "cdcur", columnDefinition = "CHAR(2)")
	private String codigoCurso;
	
	@Column(name = "cdhab", columnDefinition = "CHAR(2)")
	private String codigoHabilitacao;
	
	@Column(name = "nugra", columnDefinition = "CHAR(5)")
	private String grade;
	
	@Column(name = "turma", columnDefinition = "CHAR(1)")
	private String turma;
	
	public GradeCursoPK(){ }

	public GradeCursoPK(String codigoCurso, String codigoHabilitacao,
			String grade, String turma) {
		super();
		this.codigoCurso = codigoCurso;
		this.codigoHabilitacao = codigoHabilitacao;
		this.grade = grade;
		this.turma = turma;
	}


	public String getCodigoCurso() {
		return codigoCurso;
	}

	public void setCodigoCurso(String codigoCurso) {
		this.codigoCurso = codigoCurso;
	}

	public String getCodigoHabilitacao() {
		return codigoHabilitacao;
	}

	public void setCodigoHabilitacao(String codigoHabilitacao) {
		this.codigoHabilitacao = codigoHabilitacao;
	}

	public String getGrade() {
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	public String getTurma() {
		return turma;
	}

	public void setTurma(String turma) {
		this.turma = turma;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((codigoCurso == null) ? 0 : codigoCurso.hashCode());
		result = prime
				* result
				+ ((codigoHabilitacao == null) ? 0 : codigoHabilitacao
						.hashCode());
		result = prime * result + ((grade == null) ? 0 : grade.hashCode());
		result = prime * result + ((turma == null) ? 0 : turma.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GradeCursoPK other = (GradeCursoPK) obj;
		if (codigoCurso == null) {
			if (other.codigoCurso != null)
				return false;
		} else if (!codigoCurso.equals(other.codigoCurso))
			return false;
		if (codigoHabilitacao == null) {
			if (other.codigoHabilitacao != null)
				return false;
		} else if (!codigoHabilitacao.equals(other.codigoHabilitacao))
			return false;
		if (grade == null) {
			if (other.grade != null)
				return false;
		} else if (!grade.equals(other.grade))
			return false;
		if (turma == null) {
			if (other.turma != null)
				return false;
		} else if (!turma.equals(other.turma))
			return false;
		return true;
	}

}
